{include file='_header'}
 
<div class="page-header">
    当前位置：<span class="text-primary">配送管理</span>
</div>
<div class="page-content">
    <form action="" method="get">
        <div class="page-toolbar">
            <div class="col-sm-6">
                <a class='btn btn-primary btn-sm' href="{:url('admin/shop/dispatchadd')}"><i class='fa fa-plus'></i> 添加配送方式</a>
            </div>
            <div class="col-sm-6 pull-right">
                <div class="input-group">
                    <div class="input-group-select">
                        <select name="enabled" class='form-control input-sm select-md'>
                            <option value="" {if $enabled == ''} selected{/if}>状态</option>
                            <option value="1" {if $enabled == '1'} selected{/if}>启用</option>
                            <option value="2" {if $enabled == '0'} selected{/if}>禁用</option>
                        </select>
                    </div>
                        <input type="text" class="input-sm form-control" name='keyword' value="{$_GET['keyword']}" placeholder="名称"> <span class="input-group-btn">
                     <button class="btn btn-primary" type="submit"> 搜索</button> </span>
                </div>
            </div>
        </div>
    </form> 
    {if empty(count($list))}
    <div class='panel panel-default'>
    <div class='panel-body' style='text-align: center;padding:30px;'>
        暂时没有任何配送方式!
    </div>
</div>
        
{else}
<form action="" method="post">
    <div class="page-table-header">
        <input type='checkbox' />
        <div class="btn-group">
            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:url('admin/shop/dispatchstatus',array('enabled'=>1,'id'=>$item['id']))}"><i class='icow icow-qiyong'></i> 启用</button>
            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch'  data-href="{:url('admin/shop/dispatchstatus',array('enabled'=>0,'id'=>$item['id']))}"><i class='icow icow-jinyong'></i> 禁用</button>
            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{:url('admin/shop/dispatchdelete')}"><i class='icow icow-shanchu1'></i> 删除</button>
        </div>
    </div>
    <table class="table table-hove table-responsive">
        <thead class="navbar-inner">
            <tr>
                <th style="width:25px;"></th>
                <th style='width:50px'>顺序</th>
                <th>名称</th>
                <th  style='width:100px;'>计费方式</th>
                <th style='width:100px;'>首重(首件)价格</th>
                <th style='width:100px;'>续重(续件)价格</th>
                <th style='width:60px;'>状态</th>
                <th style='width:60px;'>默认</th>
                <th style="width: 65px;">操作</th>
            </tr>
        </thead>
        <tbody>
            {foreach name='list' item='item'}
            <tr>
                <td>
                    <input type='checkbox'   value="{$item['id']}"/>
                </td>
                <td>
                        <a href='javascript:;' data-toggle='ajaxEdit' data-href="{:url('admin/shop/dispatchdisplayorder',array('id'=>$item['id']))}" >{$item['displayorder']}</a>
                </td>
                <td>{$item['dispatchname']}</td>

                {if $item['calculatetype']==0}
                    <td>按重量计费</td>
                    <td>{$item['firstprice']}</td>
                    <td>{$item['secondprice']}</td>
                {else}
                    <td>按件计费</td>
                    <td>{$item['firstnumprice']}</td>
                    <td>{$item['secondnumprice']}</td>
                {/if}
                <td>
                    <span class='label {if $item['enabled']==1}label-primary{else}label-default{/if}'
                      data-toggle='ajaxSwitch'
                      data-switch-value='{$item['enabled']}'
                      data-switch-value0='0|禁用|label label-default|{:url('admin/shop/dispatchenabled',array('enabled'=>1,'id'=>$item['id']))}'
                      data-switch-value1='1|启用|label label-primary|{:url('admin/shop/dispatchenabled',array('enabled'=>0,'id'=>$item['id']))}'>
                    {if $item['enabled']==1}启用{else}禁用{/if}</span>
                </td>
                <td>
                    <span class='label {if $item['isdefault']==1}label-primary{else}label-default{/if} defaults'
                          data-toggle='ajaxSwitch'
                          data-switch-value='{$item['isdefault']}'
                          data-switch-value0='0|否|label label-default defaults|{:url('admin/shop/dispatchsetdefault',array('isdefault'=>1,'id'=>$item['id']))}'
                          data-switch-value1='1|是|label label-primary defaults|{:url('admin/shop/dispatchsetdefault',array('isdefault'=>0,'id'=>$item['id']))}'
                          data-switch-css='.defaults'
                          data-switch-other = 'true'>
                      {if $item['isdefault']==1}是{else}否{/if}</span>
                </td>
                <td style="text-align:left;">
                    <a href="{:url('admin/shop/dispatchedit',array('id' => $item['id']))}" class="btn btn-op btn-operation" >
                        <span data-toggle="tooltip" data-placement="top" data-original-title="修改">
                            <i class='icow icow-bianji2'></i>
                        </span>
                    </a>
                    <a data-toggle='ajaxRemove' href="{:url('admin/shop/dispatchdelete', array('id' => $item['id']))}"class="btn btn-op btn-operation" data-confirm='确认要删除此配送方式吗?'>
                        <span data-toggle="tooltip" data-placement="top" data-original-title="删除">
                           <i class='icow icow-shanchu1'></i>
                        </span>
                    </a>
                </td>
            </tr>
            {/foreach}
        </tbody>
        <tfoot>
            <tr>
                <td><input type="checkbox"></td>
                <td colspan="2">
                    <div class="btn-group">
                            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:url('admin/shop/dispatchenabled',array('enabled'=>1))}"><i class='icow icow-qiyong'></i> 启用</button>
                            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch'  data-href="{:url('admin/shop/dispatchenabled',array('enabled'=>0))}"><i class='icow icow-jinyong'></i> 禁用</button>
                            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{:url('admin/shop/dispatchdelete')}"><i class='fa fa-trash'></i> 删除</button>
                    </div>
                </td>
                <td colspan="6" style="text-align: right">
                    {$pager}
                </td>
            </tr>
        </tfoot>
    </table>
</form>
{/if}
</div>
{include file='_footer'}